package basicGUI;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import main.ChatGUI;

import javax.swing.JButton;
import javax.swing.JTextField;

public class BasicDisconnectedView extends BasicMainView{
	private JTextField txtUsername;

	public BasicDisconnectedView(ChatGUI gui) {
		super(gui);
		setLayout(null);
		
		JButton btnConnect = new JButton("Connect");
		btnConnect.setBounds(283, 134, 89, 23);
		add(btnConnect);
		
		txtUsername = new JTextField();
		txtUsername.setText("Username");
		txtUsername.setBounds(123, 135, 86, 20);
		add(txtUsername);
		txtUsername.setColumns(10);
		btnConnect.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				getGui().getController().getCurrentState().connect(txtUsername.getText());
			}
		});
	}
}
